<?php

namespace ezswoole\table;

use EasySwoole\Spl\SplBean;
use EasySwoole\Spl\SplString;

class TableField extends SplBean
{
	public function __construct( array $data = null, $autoCreateProperty = false )
	{
		$_data = [];
		foreach( $data as $key => $value ){
			$str           = new SplString( $key );
			$field         = $str->lower()->camel()->__toString();
			$_data[$field] = $value;
		}
		parent::__construct( $_data, $autoCreateProperty );
	}

	protected $field;
	protected $type;
	protected $collation;
	protected $null;

	protected $key;
	protected $default;

	protected $extra;
	protected $privileges;
	protected $comment;

	/**
	 * @return mixed
	 */
	public function getField()
	{
		return $this->field;
	}

	/**
	 * @param mixed $field
	 */
	public function setField( $field ) : void
	{
		$this->field = $field;
	}

	/**
	 * @return mixed
	 */
	public function getType()
	{
		return $this->type;
	}

	/**
	 * @param mixed $type
	 */
	public function setType( $type ) : void
	{
		$this->type = $type;
	}

	/**
	 * @return mixed
	 */
	public function getCollation()
	{
		return $this->collation;
	}

	/**
	 * @param mixed $collation
	 */
	public function setCollation( $collation ) : void
	{
		$this->collation = $collation;
	}

	/**
	 * @return mixed
	 */
	public function getNull()
	{
		return $this->null;
	}

	/**
	 * @param mixed $null
	 */
	public function setNull( $null ) : void
	{
		$this->null = $null;
	}

	/**
	 * @return mixed
	 */
	public function getKey()
	{
		return $this->key;
	}

	/**
	 * @param mixed $key
	 */
	public function setKey( $key ) : void
	{
		$this->key = $key;
	}

	/**
	 * @return mixed
	 */
	public function getDefault()
	{
		return $this->default;
	}

	/**
	 * @param mixed $default
	 */
	public function setDefault( $default ) : void
	{
		$this->default = $default;
	}

	/**
	 * @return mixed
	 */
	public function getExtra()
	{
		return $this->extra;
	}

	/**
	 * @param mixed $extra
	 */
	public function setExtra( $extra ) : void
	{
		$this->extra = $extra;
	}

	/**
	 * @return mixed
	 */
	public function getPrivileges()
	{
		return $this->privileges;
	}

	/**
	 * @param mixed $privileges
	 */
	public function setPrivileges( $privileges ) : void
	{
		$this->privileges = $privileges;
	}

	/**
	 * @return mixed
	 */
	public function getComment()
	{
		return $this->comment;
	}

	/**
	 * @param mixed $comment
	 */
	public function setComment( $comment ) : void
	{
		$this->comment = $comment;
	}


}